home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / class / objassoc.d < prev    next >
Text File  |  1996-03-27  |  1KB  |  91 lines

  1.  
  2. /*
  3.  *
  4.  *    Copyright (c) 1993-1996 Algorithms Corporation
  5.  *    3020 Liberty Hills Drive
  6.  *    Franklin, TN  37067
  7.  *
  8.  *    ALL RIGHTS RESERVED.
  9.  *
  10.  *
  11.  *
  12.  */
  13.  
  14.  
  15.  
  16. defclass  ObjectAssociation : LookupKey  {
  17.     iValue;
  18. };
  19.  
  20. cmeth    gNewWithObjObj, <vNew> (key, val)
  21. {
  22.     object    assoc;
  23.     ivType    *iv;
  24.  
  25.     ChkArgNul(key, 2);
  26.     ChkArgNul(val, 3);
  27.     assoc = gNewWithObj(super, key);
  28.     iv = ivPtr(assoc);
  29.     iValue = val;
  30.     return assoc;
  31. }
  32.  
  33. imeth    gDeepCopy()
  34. {
  35.     object    nobj;
  36.  
  37.     nobj = gDeepCopy(super);
  38.     ivPtr(nobj)->iValue = iValue ? gDeepCopy(iValue) : NULL;
  39.     return nobj;
  40. }
  41.  
  42. imeth    gValue()
  43. {
  44.     return iValue;
  45. }
  46.  
  47. imeth    gChangeValue(value)
  48. {
  49.     object    ret;
  50.     ChkArgNul(value, 2);
  51.     ret = iValue;
  52.     iValue = value;
  53.     return ret;
  54. }
  55.  
  56. imeth    object    gDeepDispose()
  57. {
  58.     if (iValue)
  59.         gDeepDispose(iValue);
  60.     return gDeepDispose(super);
  61. }
  62.  
  63. imeth    gStringRepValue()
  64. {
  65.     object    s, k, v;
  66.  
  67.     k = gKey(self);
  68.     k = k ? gStringRepValue(k) : gNewWithStr(String,"(null)");
  69.     v = iValue ? gStringRepValue(iValue) : gNewWithStr(String,"(null)");
  70.     s = vBuild(String, "( ", k, ", ", v, " )", NULL);
  71.     gDispose(k);
  72.     gDispose(v);
  73.     return s;
  74. }
  75.  
  76.  
  77.  
  78.  
  79. /*
  80.  *
  81.  *    Copyright (c) 1993-1996 Algorithms Corporation
  82.  *    3020 Liberty Hills Drive
  83.  *    Franklin, TN  37067
  84.  *
  85.  *    ALL RIGHTS RESERVED.
  86.  *
  87.  *
  88.  *
  89.  */
  90.  
  91.